SQL and NoSQL Interview Questions by Vishwanathan Narayanan

SQL and NoSQL Interview Questions by Vishwanathan Narayanan
Author: Vishwanathan Narayanan [Narayanan, Vishwanathan]
Language: eng
Format: epub
ISBN: 9789355518583
Publisher: BPB Publications
Published: 2023-02-15

Command

Explanation

db.emp.find({name:{$regex:”Vishwa”}})

Search for a document containing Vishwa.

db.emp.find({name:{$regex:/Vishwa/}})

Search for a document containing Vishwa.

db.emp.find({name:{$regex:/Vishwa/}},$options:”$i”)

Search for a document containing Vishwa with a case-insensitive nature.

db.emp.find({holidays:{$regex:”sun”}})

Search for a document where the holidays array contains the word sun.

db.emp.find({name:{$regex: /^Vi/ }})

Search for a document where the name starts with Vi.